<?php
session_start();
require_once('lib/mysql.php');
require_once('lib/utils.php');
require_once('lib/joueur.php');

// Définition du fuseau horaire
date_default_timezone_set('Europe/Paris');

// connexion à la BDD 
sql_connect();

// session de l'utilisateur 
 if(!isset($_SESSION['is_connect'])) { 
         $_SESSION['is_connect'] = false; 
 } 
  
 if(!$_SESSION['is_connect']) { 
         // connexion depuis le formulaire 
         if(isset($_POST['submit-connection'])) { 
            $email = clean_str($_POST['mail']); 
            $password =crypt_password($_POST['pass']); 
            session_connect($email, $password); 
         } 
 } 
 elseif(isset($_GET['disconnect'])) { 
         // demande de déconnexion 
         session_destroy(); 
         $_SESSION['is_connect'] = false;
 }

 
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
<head>
   <title>Pro XIV</title>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  
   <!-- website mini-icon -->
    <link rel="icon" href="design/rugby_ball.png" type="image/png" />
   <!-- css -->
   <link rel="stylesheet" media="screen" type="text/css" href="design/style.css" />
</head> 

<body>
	<div id="en_tete"> <!-- balise delimitant l'en-tête -->
	
		<?php
			//on inclut le module de connection
			include_once('include/connect.php');
		?>
	</div>	
	<div id="middle">
	
	<div id="menu" class="colonne">
			<?php
			// on inclut le menu, toujours le même
			include_once('include/menu.php');
			?>
			
	</div>
	
	<div id="global" class="colonne"><?php
	// on regarde quel est le paramètre "page" de l'url (il est determiné par le lien cliqué, voir menu.php)
	if(isset($_GET['page']))
		$page = $_GET['page'];
	else
		$page = '';
	// on inclut la page correspondante
	switch($page) {
		default:
			include_once('pages/accueil.php');
			break;
			
		case 'accueil':
			include_once('pages/accueil.php');
			break;
		
		case 'classement_championnat':
			include_once('pages/classement_championnat.php');
			break;
			
		case 'actualites':
			include_once('pages/actualites.php');
			break;
			
		case 'calendrier':
			include_once('pages/calendrier.php');
			break;
		
		case 'palmares':
			include_once('pages/palmares.php');
			break;
			
		case 'inscription':
			include_once('pages/inscription.php');
			break;
			
		case 'mes_paris':
			include_once('pages/mes_paris.php');
			break;
		
		case 'classement_parieurs':
			include_once('pages/classement_parieurs.php');
			break;
		
		case 'gestion_groupes':
			include_once('pages/gestion_groupes.php');
			break;
		
		case 'multimedias':
			include_once('pages/multimedias.php');
			break;
		
		case 'carte':
			include_once('pages/carte.php');
			break;
		
		case 'forum':
			include_once('pages/forum.php');
			break;
			
		case 'mon_profil':
			include_once('pages/mon_profil.php');
			break;
			
		case 'caleidoscope':
			include_once('pages/caleidoscope.php');
			break;
		
			
		case 'contacts':
			include_once('pages/contacts.php');
			break;
		
		
		case 'saisie_scores':
			include_once('pages/saisie_scores.php');
			break;
			
		case 'caleidoscope_admin':
			include_once('pages/caleidoscope_admin.php');
			break;
			
		case 'actualites_admin':
			include_once('pages/actualites_admin.php');
			break;
			
		case 'gestion_newsletters':
			include_once('pages/gestion_newsletters.php');
			break;
			
		case 'gestion_calendrier':
			include_once('pages/gestion_calendrier.php');
			break;
		
		
		case 'fin_saison':
			include_once('pages/fin_saison.php');
			break;
	}
	?>
		
	</div> <!-- fin global -->
	
	</div> <!-- fin middle -->

	<div id="pied_de_page"><?php echo'<a href="pages/Documentation USER.pdf">Aide</a> - <a href="index.php?page=contacts">Contact</a> - Icons from <a href="http://famfamfam.com">famfamfam</a>';?> <!-- balise delimitant le pied de page -->
	</div>

	<!-- javascript -->
	<script type="text/javascript" src="javascript/jquery-1.4.2.min.js"></script>
	<script type="text/javascript" src="javascript/carte.js"></script>
</body>
</html>